package LeetCode;

public class LC_551_StudentAttendanceRecordI {

    public static void main(String[] args) {

    }

    public class Solution {
        public boolean checkRecord(String s) {
            char[] array = s.toCharArray();
            int countA = 0;
            int countL = 0;
            for (char x : array) {
                if ('A' == x) {
                    countA++;
                    if (countA > 1) {
                        return false;
                    }
                }
                if ('L' == x) {
                    countL++;
                    if (countL > 2) {
                        return false;
                    }
                } else {
                    countL = 0;
                }

            }
            return true;
        }

    }
}